package com.test;

import org.jsoup.Connection;
import org.jsoup.Jsoup;



public class getReallyUrl {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
	     try {  
//	        	 HttpClient http = new HttpClient();  
//	             GetMethod getMethod = new GetMethod("https://www.baidu.com/link?url=tlxHtrmlLFYz5m1tLDoyQuhdQvjJy3H2Y_6gRaGdbigSKbUUakq23FBrRTG80HRPkLMUeUEBnJO-3hWzrua2RFOFQcKdBiWJFCvjfbN3-cG");  
//	        
//            getMethod.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0");  
//            getMethod.setFollowRedirects(false);  
//            http.executeMethod(getMethod);  
//            System.out.println(getMethod.getStatusCode());   
//               System.out.println(getMethod.getResponseBodyAsString());   
//            for(Header h : getMethod.getResponseHeaders()){  
//                System.out.println(h.getName()+":"+h.getValue());  
//            }  
	    	 
	    	 
	    	 Connection.Response res = Jsoup.connect("https://www.baidu.com/link?url=NsHkjUPGl_mZhzM-TUlu6ZfyO3os9ubGKhDv9XiMklKxONjEtFTVLyrKWiW50gJzRFL2hChm_hkarUGQkmwPS_").timeout(60000).method(Connection.Method.GET).followRedirects(false).execute();
	    	 String str= res.header("Location");
	    	 
	    	 System.out.println(str);
        } catch (Exception e) {  
            e.printStackTrace();  
        }  

	}

}
